package com.datastructure.tree.rtree;

import static org.junit.Assert.*;

import org.junit.Before;
import org.junit.Test;

public class Point2DTest {

	@Before
	public void setUp() throws Exception {
	}

	@Test
	public void testGetQuad() {
		
		Point2D one = new Point2D(0,0);
		Point2D two = new Point2D(0,0);
		
		// SW,W,NW,S,CENTER,N,SE,E,NE
		two.setX(-1); two.setY(-1);
		assertEquals(Quadrant.SW, one.getQuad(two));
		
		two.setY(0);
		assertEquals(Quadrant.W, one.getQuad(two));
		
		two.setY(1);
		assertEquals(Quadrant.NW, one.getQuad(two));
		
		two.setX(0); two.setY(-1);
		assertEquals(Quadrant.S, one.getQuad(two));
		
		two.setY(0);
		assertEquals(Quadrant.CENTER, one.getQuad(two));
		
		two.setY(1); 
		assertEquals(Quadrant.N, one.getQuad(two));
		
		two.setX(1); two.setY(-1); 
		assertEquals(Quadrant.SE, one.getQuad(two));
		
		two.setY(0); 
		assertEquals(Quadrant.E, one.getQuad(two));
		
		two.setY(1); 
		assertEquals(Quadrant.NE, one.getQuad(two));		

	}

}
